package com.njworkorder.Service.Impl;

import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njworkorder.Entity.Components;
import com.njworkorder.Entity.MaintenanceMethod;
import com.njworkorder.Entity.ModelNum;
import com.njworkorder.Entity.Parts;
import com.njworkorder.Service.ComponentsService;
import com.njworkorder.Mapper.ComponentsMapper;
import com.njworkorder.VO.ComponentsListVo;
import org.springframework.stereotype.Service;

/**
* @author iron
* @description 针对表【components】的数据库操作Service实现
* @createDate 2024-11-12 14:00:12
*/
@Service
public class ComponentsServiceImpl extends MPJBaseServiceImpl<ComponentsMapper, Components>
    implements ComponentsService{

    @Override
    public MPJLambdaWrapper<Components> getMPJWrapper() {
        return  new MPJLambdaWrapper<Components>()
                .selectAll(Components.class)
                .leftJoin(ModelNum.class,ModelNum::getId,Components::getModelNumId,ext ->
                        ext.selectAs(ModelNum::getModelName, ComponentsListVo::getModelName))
                .leftJoin(Parts.class,Parts::getId,Components::getPartsId,ext ->
                        ext.selectAs(Parts::getPartsName, ComponentsListVo::getPartsName)
                                .selectAs(Parts::getUnit, ComponentsListVo::getUnit))
                .leftJoin(MaintenanceMethod.class,MaintenanceMethod::getId,Components::getMaintenanceMethodId,ext ->
                        ext.selectAs(MaintenanceMethod::getMethodName, ComponentsListVo::getMethodName));
    }
}




